#include "ISNW_Screen.h"
using namespace ISNW;

ISNW_Screen::ISNW_Screen()
:m_currState(&m_dead)
{
	m_dead.Init(this);
	m_normal.Init(this);
	m_normal2dead.Init(this);
	m_dead2normal.Init(this);
}

ISNW_Screen::~ISNW_Screen()
{
	Release();
}

ISNW_VOID ISNW_Screen::Init()
{
	m_dead.Init(this);
	m_normal.Init(this);
	m_normal2dead.Init(this);
	m_dead2normal.Init(this);
	m_currState = &m_normal;
}

ISNW_VOID ISNW_Screen::Release()
{
}

ISNW_Button* ISNW_Screen::AddBtn()
{
	return m_container.AddBtn();
}

ISNW_Panel* ISNW_Screen::AddPanel()
{
	return m_container.AddPanel();
}

ISNW_EntityBox* ISNW_Screen::AddEntityBox()
{
	return m_container.AddEntityBox();
}

ISNW_Container* ISNW_Screen::AddContainer()
{
	return m_container.AddContainer();
}

ISNW_Edit* ISNW_Screen::AddEdit()
{
	return m_container.AddEdit();
}

ISNW_VOID ISNW_Screen::ProcessInput(ISNW_InputInfo ii)
{
	m_currState->ProcessInput(ii);
}

ISNW_VOID ISNW_Screen::ProcessCursor(POINT pos)
{
	m_currState->ProcessCursor(pos);
}

ISNW_VOID ISNW_Screen::RenderAllControl()
{
	m_container.Render();
}

ISNW_VOID ISNW_Screen::Render()
{
	m_currState->Render();
}

ISNW_VOID ISNW_Screen::SetState(ISNW_SCREEN_STATE st)
{
	switch(st){
		case ISNW_SCREEN_STATE_NORMAL:
			m_currState = &m_normal;
			break;
		case ISNW_SCREEN_STATE_NORMAL2DEAD:
			m_currState = &m_normal2dead;
			break;
		case ISNW_SCREEN_STATE_DEAD:
			m_currState = &m_dead;
			break;
		case ISNW_SCREEN_STATE_DEAD2NORMAL:
			m_currState = &m_dead2normal;
			break;
		default:
			break;
	}
}
